package com.terminee.factories;

import com.terminee.behaviors.DAOBehavior;
import com.terminee.dataaccess.DatabaseDAO;

/**
 * Factory for creating database DAO's
 * 
 * @author potlow
 *
 */
public abstract class DatabaseDAOFactory {

	public DatabaseDAO getDAO(int type) {
        DatabaseDAO databaseDAO = createDAO(createDAOBehavior(type));
        return databaseDAO;
    }

    protected abstract DAOBehavior createDAOBehavior(int type);

    protected DatabaseDAO createDAO(DAOBehavior daoBehavior) {
    	DatabaseDAO databaseDAO = new DatabaseDAO();
    	databaseDAO.setDAOBehavior(daoBehavior);
    	return databaseDAO;
    }
}
